package com.lagou.niancheng.lagou.service.mail.controller;

import com.lagou.niancheng.lagou.service.common.EmailDTO;
import com.lagou.niancheng.lagou.service.common.Result;
import com.lagou.niancheng.lagou.service.common.ResultBuilder;
import com.lagou.niancheng.lagou.service.mail.service.MailService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * com.lagou.niancheng.lagou.service.mail.controller.MailController
 *
 * @author wlz
 * @date 2020/12/22
 */
@RestController
@RequestMapping("/mail")
public class MailController {

    @Resource
    private MailService mailService;

    @PostMapping("/send")
    public Result sendMail(@RequestBody EmailDTO emailDTO) {
        mailService.sendMail(emailDTO.getEmail(), emailDTO.getCode());
        return ResultBuilder.toSuccess(null);
    }
}
